package com.woate.fastvalidaton;


import javax.validation.ValidatorFactory;
import javax.validation.spi.BootstrapState;
import javax.validation.spi.ConfigurationState;
import javax.validation.spi.ValidationProvider;

import com.woate.fastvalidation.common.logging.LogFactory;
import com.woate.fastvalidation.common.logging.Logger;
import com.woate.fastvalidaton.internal.ConfigurationImpl;
import com.woate.fastvalidaton.internal.ValidatorFactoryImpl;
/**
 * FastValidaton入口类<br>
 * 默认实现了{@code ValidationProvider}，使用META-INFO/javax.validation.spi.ValidationProvider中记录了本类。实现自动加载实现。<br>
 * @author woate
 *
 */
public class FastValidator implements ValidationProvider<ConfigurationImpl>{
	static Logger LOGGER = LogFactory.getLog(FastValidator.class);
	@Override
	public ConfigurationImpl createSpecializedConfiguration(BootstrapState state) {
		return ConfigurationImpl.class.cast(new ConfigurationImpl(state));
	}

	@Override
	public ConfigurationImpl createGenericConfiguration(BootstrapState state) {
		return new ConfigurationImpl(state);
	}

	@Override
	public ValidatorFactory buildValidatorFactory(ConfigurationState configurationState) {
		return new ValidatorFactoryImpl(configurationState);
	}

}
